We were required to follow a proven agile Software Engineering development paradigm when developing the game. As such, we were required to produce a specification document, including a product backlog, for the game that we have created; then to follow up with a design, using an object-oriented approach, and implement the game. My responsibilties included: Enemy game objects, sprite sheet animation, enemy motion and kinematics across all levels. Collectable objects development. However I also helped other group members to develop their features.
Enemies move within their respective zone (it could be patrol area or chase area) They are able to spot the Player once he is overlapping the sight area. They will chase player if he is overlapping chase area. They will return to patrol their area if Player is outside the chase area. Enemies can do melee and ranged attacks (it depends on the enemy type - ranged enemies can do both melee and ranged attacks).Enemies can hurt the player by either applying damage via projectiles or by doing the melee attack. Enemies can take damage from the Player by using collision with player's bullets.
After damage is being taken, the damage value will be displayed next to the enemy animated sprite. The health bars and health system has been developed for the Enemies but it is also used for the Player character. I used sf::Rectangle Shapes to create the health bar (Red) and the background for it (Blue). The Enemies are created via Enemy Factory. I used Factory Design Pattern to implement Enemies Factory. Then I used it inside each Level GameState and EliteEnemy class in order to create new Enemies(using MakeEnemy() function).
Each Enemy reacts on collision with a bullet. If collision takes place, the damage is being applied to the enemy (based on the bullet damage value). Then the bullet is being destroyed.
For collectible Items I also used Factory Design Pattern. All items react to collision with player. Here I used standard SFML method to implement collision (Global Bounds intersection between two sprites). There are 3 items available: Ammo, Health and Coin pickups. After being picked up the item will be destroyed but first the information about what type and what value the item gave to the Player. Ammo will increase the player's ammo amount, health pick up will increase the player's health and coin pickup will be added to the coins found by the player. Coins are the scoring system in our game. Each enemy will drop certain amount of coins to collect. Each item type has its unique sound.
I have created the base class EnemyWeaponBase. From this class I have help to create inherited weapon type: BlitzWeaponTest. It is a base class for EnemyBlitzWeapon,PistolWeapon and AssaultRifleWeapon. Weapons and Bullets have a Boolean isPlayerBullet. It is used to check during the collision event who should take damage and should bullet be destroyed in collision with the collider. For example we do not want to destroy a bullet which has been created from the player's weapon in collision with the player.
I helped to create Victory and Defeat Game States. Both Game States are similar so there is a background sprite with the text on top. Depending on the game state there could be Victory or Defeat text. Then the amount of coins collected by the player and information to press the Enter key to proceed to the Main Menu. I extended the GameStateTest class so that it is now the base class for all the levels. Using this approach all game levels have the most important variables in place, without a need to create them again(i.e items array, enemies array).
In each level's update function there is checking for the win/loose conditions. If the level is not the last level of the game the next level will be loaded. If Player finished the last level the Victory screen will be displayed. I have made the transitions between the game states simply using the pointers of a next level classes and game states manager pointers.
Each level saves the current amount of coins, lives and ammo and load this amount into the next level. Using this approach those properties are updated during the game, even if player changed the level. On the Victory screen the amount of coins collected during the whole game is being displayed.
I helped to create the HUD for the Player. The code for the HUD is placed inside the GameStateTest class so that it is also inherited by all the game levels. I used Text pointers to create instances of the text and to be able to easily clear the memory dynamically. The new pointers for each text (enemies left, coins, lives and ammo) are being created and destroyed each frame.